package ebookcleaner;

public enum FILETYPE {

	TXT("txt"), PDF("pdf"), HWP("hwp"), ZIP("zip"), RAR("rar"), GUL("gul"),
	MP3("mp3"), AVI("avi"), MP4("mp4"), M4U("m4u"), WMV("wmv"),  
	DOC("doc"), DOCX("docx"), PPT("ppt"), PPTX("pptx"), XLS("xls"), XLSX("xlsx"),
	NULL("null"),;
	
	String ext;

	FILETYPE(String ext) {
		this.ext = ext;
	}

	String getExt() {
		return this.ext;
	}

	boolean equal(String ext) {
		if (this.ext.equalsIgnoreCase(ext))
			return true;
		else
			return false;
	}

	public static FILETYPE getFileType(String ext) {

		FILETYPE filetype = NULL;

		for (FILETYPE each : FILETYPE.values()) {
			if (each.ext.equalsIgnoreCase(ext)) {
				filetype = each;
				break;
			}
		}
		return filetype;
	}
}
